if (window.HTMLElement) {
	// swapNode无法应用于FF-交换节点
	Node.prototype.swapNode = function($target) {
		var $targetParent = $target.parentNode;
		var $targetNextSibling = $target.nextSibling;
		var $thisNode = this.parentNode.replaceChild($target, this);
		$targetNextSibling ? $targetParent.insertBefore($thisNode,
				$targetNextSibling) : $targetParent.appendChild($thisNode);
		return this;
	}
	// replaceNode无法应用于FF-替换指定节点
	Node.prototype.replaceNode = function(Node) {
		this.parentNode.replaceChild(Node, this);
	}
	// removeNode无法应用于FF-删除指定节点
	Node.prototype.removeNode = function(removeChildren) {
		if (removeChildren)
			return this.parentNode.removeChild(this);
		else {
			var range = document.createRange();
			range.selectNodeContents(this);
			return this.parentNode.replaceChild(range.extractContents(), this);
		}
	}

	// dom的all无法应用于FF
	HTMLElement.prototype.__defineGetter__("all", function() {
		var a = this.getElementsByTagName("*");
		var node = this;
		a.tags = function(sTagName) {
			return node.getElementsByTagName(sTagName);
		}
		return a;
	});
	// dom的parentElement无法应用于FF
	HTMLElement.prototype.__defineGetter__("parentElement", function() {
		if (this.parentNode == this.ownerDocument)
			return null;
		return this.parentNode;
	});
	// children无法应用于FF
	HTMLElement.prototype.__defineGetter__("children", function() {
		var tmp = [];
		var j = 0;
		var n;
		for ( var i = 0; i < this.childNodes.length; i++) {
			n = this.childNodes[i];
			if (n.nodeType == 1) {
				tmp[j++] = n;
				if (n.name) {
					if (!tmp[n.name])
						tmp[n.name] = [];
					tmp[n.name][tmp[n.name].length] = n;
				}
				if (n.id)
					tmp[n.id] = n;
			}
		}
		return tmp;
	});
	// Dom的innerText属性无法应用于FF-取值
	HTMLElement.prototype.__defineGetter__("innerText", function() {
		return this.textContent;
	});
	// Dom的innerText属性无法应用于FF-赋值
	HTMLElement.prototype.__defineSetter__("innerText", function(sText) {
		this.textContent = sText;
	});
	// Dom的outerHTML属性无法应用于FF-赋值
	HTMLElement.prototype.__defineSetter__("outerHTML", function(sHTML) {
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var df = r.createContextualFragment(sHTML);
		this.parentNode.replaceChild(df, this);
		return sHTML;
	});
	// Dom的outerHTML属性无法应用于FF-取值
	HTMLElement.prototype.__defineGetter__("outerHTML", function() {
		var attr;
		var attrs = this.attributes;
		var str = "<" + this.tagName.toLowerCase();
		for ( var i = 0; i < attrs.length; i++) {
			attr = attrs[i];
			if (attr.specified)
				str += " " + attr.name + '="' + attr.value + '"';
		}
		if (!this.canHaveChildren)
			return str + ">";
		return str + ">" + this.innerHTML + "</" + this.tagName.toLowerCase()
				+ ">";
	});
	// Dom的outerText属性无法应用于FF-赋值
	HTMLElement.prototype.__defineSetter__("outerText", function(sText) {
		var parsedText = document.createTextNode(sText);
		this.outerHTML = parsedText;
		return parsedText;
	});
	// Dom的outerText属性无法应用于FF-取值
	HTMLElement.prototype.__defineGetter__("outerText", function() {
		var r = this.ownerDocument.createRange();
		r.selectNodeContents(this);
		return r.toString();
	});
	// dom的runtimeStyle无法应用于FF
	HTMLElement.prototype.__defineGetter__("runtimeStyle", function() {
		return this.style;
	});
	// dom的currentStyle无法应用于FF
	HTMLElement.prototype.__defineGetter__("currentStyle", function() {
		return this.ownerDocument.defaultView.getComputedStyle(this, null);
	});
	// dom的canHaveChildren无法应用于FF
	HTMLElement.prototype.__defineGetter__("canHaveChildren", function() {
		switch (this.tagName.toLowerCase()) {
		case "area":
		case "base":
		case "basefont":
		case "col":
		case "frame":
		case "hr":
		case "img":
		case "br":
		case "input":
		case "isindex":
		case "link":
		case "meta":
		case "param":
			return false;
		}
		return true;
	});
	// attachEvent无法应用于FF;sType(事件类型)，fHandler(绑定对象)
	HTMLElement.prototype.attachEvent = function(sType, fHandler) {
		var shortTypeName = sType.replace(/on/, "");
		fHandler._ieEmuEventHandler = function(e) {
			window.event = e;
			return fHandler();
		}
		this.addEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);
	}
	// detachEvent无法应用于FF;
	HTMLElement.prototype.detachEvent = function(sType, fHandler) {
		var shortTypeName = sType.replace(/on/, "");
		if (typeof (fHandler._ieEmuEventHandler) == "function")
			this.removeEventListener(shortTypeName,
					fHandler._ieEmuEventHandler, false);
		else
			this.removeEventListener(shortTypeName, fHandler, true);
	}
	// contains无法应用于FF-包含
	HTMLElement.prototype.contains = function(Node) {
		do
			if (Node == this) {
				return true;
			}
		while (Node = Node.parentNode);
		return false;
	}
	// insertAdjacentElement无法应用于FF
	/*
	 * swhere: 指定插入html标签语句的地方，有四种值可用： 1.beforeBegin: 插入到标签开始前
	 * 2.afterBegin:插入到标签开始标记之后 3.beforeEnd:插入到标签结束标记前 4.afterEnd:插入到标签结束标记后
	 * stext：要插入的内容
	 */
	HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode) {
		switch (where) {
		case "beforeBegin":
			this.parentNode.insertBefore(parsedNode, this);
			break;
		case "afterBegin":
			this.insertBefore(parsedNode, this.firstChild);
			break;
		case "beforeEnd":
			this.appendChild(parsedNode);
			break;
		case "afterEnd":
			if (this.nextSibling)
				this.parentNode.insertBefore(parsedNode, this.nextSibling);
			else
				this.parentNode.appendChild(parsedNode);
			break;
		}
	}
	// insertAdjacentHTML无法应用于FF
	HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr) {
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where, parsedHTML);
	}
	// insertAdjacentText无法应用于FF
	HTMLElement.prototype.insertAdjacentText = function(where, txtStr) {
		var parsedText = document.createTextNode(txtStr);
		this.insertAdjacentElement(where, parsedText);
	}

	// event.x和event.y无法应用于FF-相对文档的水平座标
	Event.prototype.__defineGetter__("x", function() {
		return this.pageX;
	});
	Event.prototype.__defineGetter__("y", function() {
		return this.pageY;
	});
	// offsetX和offsetY无法应用于FF-相对容器的水平坐标
	if (window.navigator.userAgent.indexOf("Firefox") > 0) {
		Event.prototype.__defineGetter__("offsetX", function() {
			return this.layerX;
		});
		Event.prototype.__defineGetter__("offsetY", function() {
			return this.layerY;
		});
	}
	// srcElement无法应用于FF-设置或获取触发事件的对象
	/*
	 * 引用对象，这个对象有什么属性，就可以使用。 常用的有： event.srcElement.TagName 事件对象的html标记
	 * event.srcElement.innerText 事件对象的内文本 event.srcElement.value 表单事件对象的值
	 */
	Event.prototype.__defineGetter__("srcElement", function() {
		return this.target;
	});
	// fromElement无法应用于FF-返回鼠标移出的源节点
	Event.prototype.__defineGetter__("fromElement", function() {
		var node;
		if (this.type == "mouseover")
			node = this.relatedTarget;
		else if (this.type == "mouseout")
			node = this.target;
		if (!node)
			return;
		while (node.nodeType != 1)
			node = node.parentNode;
		return node;
	});
	// toElement无法应用于FF-返回鼠标移入的源节点
	Event.prototype.__defineGetter__("toElement", function() {
		var node;
		if (this.type == "mouseout")
			node = this.relatedTarget;
		else if (this.type == "mouseover")
			node = this.target;
		if (!node)
			return;
		while (node.nodeType != 1)
			node = node.parentNode;
		return node;
	});
	//window.event无法应用于FF
	window.constructor.prototype.__defineGetter__("event",__window_event_constructor);

}